package com.bite.ojcommonsecurity.interceptor;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

@Slf4j
@Component
public class TokenInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        // 对用户token进行刷新
        // 请求路径 网关 -- 拦截器 -- controller --- 到达拦截器说明用户身份正确且已经登录，可以直接对用户token进行刷新

        // TODO
        log.info("对请求进行拦截 {} " ,request.getRequestURI());
        return HandlerInterceptor.super.preHandle(request, response, handler);
    }
}
